 //**************************************************************
 // Student.java    Author:20172323wyh
 //
 // Reprsents a coolge student.
 //**************************************************************
 
 public class Student 
 {  
    private int score1, score2, score3, test1, test2, test3;
    private String firstName, lastName;
    private Address homeAddress, schoolAddress;
    private double average;
    //---------------------------------------------------------------
    // Constructors: Sets up this student with the specified values.
    //---------------------------------------------------------------
    
    public Student(String first, String last, Address home, Address school, int score1, int score2, int score3)
    {
       firstName = first;
       lastName = last;
       homeAddress = home;
       schoolAddress = school;
       this.score1 = score1;
       this.score2 = score2;
       this.score3 = score3;
    }
    //---------------------------------------------------------------
    // Method overloading: makes all test score back to 0.
    //---------------------------------------------------------------
    public Student(String first,String last, Address home, Address school)
    {
     firstName = first;
     lastName = last;
     homeAddress = home;
     schoolAddress = school;
     score1 = 0;
     score2 = 0;
     score3 = 0;
    }
   
    //---------------------------------------------------------------
    // Sets the score of student.
    //--------------------------------------------------------------
    public void setTestScore( int number1, int score1, int number2, int score2, int number3, int score3)
    {
     this.score1 = score1;
     this.score2 = score2;
     this.score3 = score3;
     test1 = number1;
     test2 = number2;
     test3 = number3;
    }

    //---------------------------------------------------------------
    // Gets the score of student.
    //---------------------------------------------------------------
    public int getTestScore(int Number)
    {
      if (Number == test1)
         return score1;
      else
         if (Number == test2)
         return score2;
         else
            if (Number == test3)
            return score3;
            else 
            return 0;
     }

     //---------------------------------------------------------------
     // Calculates the average-number and returns it.
     //---------------------------------------------------------------
     public double ave()
     {
       average = (score1 + score2 + score3)/3;
       return average;
     }
       
    //---------------------------------------------------------------
    // Returns a string description of this Student objects.
    //---------------------------------------------------------------
    public String toString()
    {
       String result;

       result = firstName + " " + lastName + "\n";
       result += "Home Address:\n" + homeAddress + "\n";
       result += "School Address:\n" + schoolAddress;
       result += "\nScore1: " + score1 + "\tScore2: " + score2 + "\tScore3:" + score3 +
"\n";
       result += "Average: " + ave();

       return result;
    }
 }

       
